Ext.define('TS.store.BaStore', { 
	extend: 'Ext.data.Store', 
	requires: 'TS.model.BaModel', 
	model: 'TS.model.BaModel' ,
    pageSize: 20, 
    remoteSort: true,
	autoLoad: true, 
	 proxy: { 
		  type: 'ajax', 
		  url: 'app/data/BaList.json', 
		  reader: { 
		   type: 'json', 
		   root: 'results' 
		  } 
	 },
     simpleSortMode: true,
     listeners:{
		  update:function(store,record){
			   var currPage = store.currentPage;
			   //alert(record.get("ID"))
			   Ext.Ajax.request({
				    url:'app/data/updateUsers.json',
				    params:{
					     id : record.get("ID"),
					     kehu_name:record.get("kehu_name"),
					     beianhao:record.get("beianhao"),
					     beianpass:record.get("beianpass"),
					     beianemail:record.get("beianemail"),
					     emailpass:record.get("emailpass"),
					     beianzh:record.get("beianzh"),
					     beianzhpa:record.get("beianzhpa")
				    },
				    success:function(response){
                         console.log("update ok");
					     //store.removeAll();
					     //store.load(currPage);
				    }
			   });
		  },
		 remove:function(store,record){
			   var currPage = store.currentPage;
			   //alert(record.get("ID"))
			   Ext.Ajax.request({
				    url:'app/data/Success.json',
				    params:{
				     id : record.get("ID")
			         },
				    success:function(response){
                         console.log("delete ok");
					     //store.removeAll();
					     //store.load(currPage);
				    }
			   });
			  }
		 },
	  sorters: [{
		  property: 'ID',
		  direction: 'DESC'
	 }]
})